package com.hakim.wfb.common.enums;

/**
 * Created by walkman on 2017/7/9.
 */
public enum UserLoginStatus {

    LOGIN_SUCCESS(1, "登录成功"),
    LOGIN_FAILED(2, "登录失败"),;

    private Integer code;
    private String message;

    UserLoginStatus(Integer code, String value) {
        this.code = code;
        this.message = value;
    }

    public static UserLoginStatus getByCode(Integer value) {
        for (UserLoginStatus type : values()) {
            if (type.getCode().equals(value)) {
                return type;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static UserLoginStatus getByCode(int code) {
        UserLoginStatus[] codes = values();
        for (UserLoginStatus each : codes) {
            if (each.code == code) {
                return each;
            }
        }
        return null;
    }

}

